|
mruby 4.0.0
mruby is the lightweight implementation of the Ruby language
|
Amalgamation combines all mruby source files into a single mruby.c and mruby.h for easy embedding, similar to SQLite's distribution model.
Output files are generated in build/<target>/amalgam/:
mruby.h - All headers concatenated in dependency ordermruby.c - All sources concatenated (core + gems + mrblib)The amalgamation includes gems specified in your build configuration:
For optimized builds:
The following gems work with amalgamation:
mruby-compiler - Required for mrb_load_stringmruby-eval - eval, Bindingmruby-array-ext, mruby-string-ext, mruby-hash-extmruby-numeric-ext, mruby-range-ext, mruby-symbol-extmruby-proc-ext, mruby-kernel-ext, mruby-object-ext, mruby-class-extmruby-enum-ext, mruby-compar-extmruby-error, mruby-math, mruby-structmruby-bigint, mruby-rational, mruby-complexmruby-io (with hal-posix-io)mruby-task (with hal-posix-task)Gems that use a HAL (Hardware Abstraction Layer) include platform-specific code in the amalgamation. For example, if mruby-io selects hal-posix-io on Linux, the generated mruby.c contains POSIX-specific code and cannot be compiled on Windows.
If you need amalgamated files for multiple platforms, generate them separately for each target platform (or cross-build configuration).
Binary gems (mruby-bin-*) are automatically excluded as they contain their own main() function. The amalgamation produces a library, not an executable.
A minimal configuration for amalgamation:
Generate with:
Typical sizes depend on included gems:
mruby.h: 200-500 KBmruby.c: 2-4 MBmruby.h)mruby/ops.h) are inlined at each use.cstub files) are automatically inlinedmrblib.c, gem_init.c) are includedGems that add preprocessor defines affecting core structures are automatically detected and included at the top of mruby.h. Supported patterns: MRB_USE_*, MRB_UTF8_*, HAVE_MRUBY_*.
src/*.c)mrbgems/*/src/*.c or core/*.c)build/*/mrblib/mrblib.c)build/*/mrbgems/gem_init.c)